<include file="public@header"/>
<style>
    .cas-thumbnail{
        width:80px;
        height:80px;
    }
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('AdminPack/index')}">产品检索</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminPack/index')}">
        CAS：
        <input type="text" class="form-control" name="cas" style="width:100px;" value="{:input('param.cas')}" placeholder="输入CAS">
        &nbsp;&nbsp;&nbsp;产品编号：
        <input type="text" class="form-control" name="product_no" style="width:100px;" value="{:input('param.product_no')}" placeholder="产品编号">
        &nbsp;&nbsp;&nbsp;关键字：
        <input type="text" class="form-control" name="keyword" style="width: 200px;" value="{:input('param.keyword')}" placeholder="化合物名称/分子式">
        &nbsp;&nbsp;&nbsp; <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('AdminPack/index')}">清空</a>
        <span style="float:right;padding-top: 8px" > <span class="form-required">*</span>请用CAS:57260-73-8检索测试</span>
    </form>
    <form method="post" class="js-ajax-form margin-top-20" action="">
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th>序号</th>
                <th>
                    产品名称
                </th>
                <th>
                    CAS
                </th>
                <th>
                    货号
                </th>
                <th>
                    结构式
                </th>
                <th>库存量</th>
                <th>
                    包装
                </th>
                <th>
                    纯度
                </th>
                <th>备货期</th>

            </tr>
            </thead>
            <tbody><php>$i=0;</php>
            <foreach name="packs" item="vo">
                <php>$i=$i+1;</php>
                <tr>
                    <td>{$i}</td>
                    <td><a href="javascript:parent.openIframeLayer('{:url('AdminProduct/packs',array('id'=>$vo['product']['id']))}','产品库存',{});">{$vo.product.cn_name}<br>{$vo.pack.product.name}</a></td>
                    <td>{$vo.product.cas}</td>
                    <td>{$vo.product_no}</td>
                    <td>
                        <eq name="vo.thumbnail" value="has">
                            <img src="http://www.chemium.cn/chemium/api/getCompoundPng/cas/{$vo.cas}" class="cas-thumbnail" onerror="javascript:this.style.visibility='hidden';"/><br>
                            <else/>
                            <notempty name="vo.thumbnail">
                                <img src="{:cmf_get_image_preview_url($vo.thumbnail)}" class="cas-thumbnail" onerror="javascript:this.style.visibility='hidden';"/><br>
                                <else/>
                                <div style="width: 80px;height: 80px;background: #fff;">
                                    <img src="http://www.chemium.cn/chemium/api/getCompoundPng/cas/{$vo.cas}" class="cas-thumbnail" onerror="javascript:this.style.visibility='hidden';"/>
                                </div>
                            </notempty>
                        </eq>
                        {:sp_beautify_molformula($vo['mol_formula'])}
                    </td>
                    <td>
                        <empty name="vo.inventory">
                            缺货
                            <else/>
                            {$vo.inventory}{$vo.packing_material}
                        </empty>
                    </td>
                    <td>
                        {$vo.pack}{$vo.unit}
                    </td>

                    <td>
                        {$vo.purity}
                    </td>

                    <td>
                        <empty name="vo.inventory">
                            {$vo.lead_time}天
                            <else/>
                            现货
                        </empty>
                    </td>


                    <!--<td>
                        <a href="javascript:parent.openIframeLayer('{:url('AdminProduct/packs',array('id'=>$vo['product']['id']))}','产品库存',{});">库存</a>
                    </td>-->
                </tr>
            </foreach>
            </tbody>
        </table>
        <ul class="pagination">{$page|default=''}</ul>
    </form>
</div>
<img id="cas-thumbnail-bigger" style="position: fixed;top: 50%;left: 50%;width: 300px;height: 300px;margin-left: -150px;margin-top: -150px;display: none;box-shadow: 0px 0px 20px rgba(0,0,0,0.2);"/>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $(function(){
        var $cas_thumbnail_bigger=$('#cas-thumbnail-bigger');
        $('.cas-thumbnail').hover(function(){
            $cas_thumbnail_bigger.attr('src',$(this).attr('src'));
            $cas_thumbnail_bigger.show();
        },function(){
            $cas_thumbnail_bigger.hide();
        });
    });

</script>
</body>
</html>